<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <link rel="stylesheet" th:href="@{/static/element/index.css}"/>
</head>
<body>
<style>
    .el-input-item{
        width: 260px;
    }

</style>
<div id="app">
    <template>
        <el-form :model="formData" ref="formData" :rules="rules" label-width="100px" style="margin-top: 5%;display: flex;flex-direction: row;align-items: center;flex-wrap: wrap;justify-content: space-between;margin-right: 5%">
                                                                                                                                                                                <el-form-item label="用户账号" prop="userName">
                                <el-input class="el-input-item" size="small" v-model="formData.userName" placeholder="请输入用户账号"/>
                            </el-form-item>
                                                                                                                                                                                                                <el-form-item label="登录IP地址" prop="ipaddr">
                                <el-input class="el-input-item" size="small" v-model="formData.ipaddr" placeholder="请输入登录IP地址"/>
                            </el-form-item>
                                                                                                                                                                                                                <el-form-item label="登录地点" prop="loginLocation">
                                <el-input class="el-input-item" size="small" v-model="formData.loginLocation" placeholder="请输入登录地点"/>
                            </el-form-item>
                                                                                                                                                                                                                <el-form-item label="浏览器类型" prop="browser">
                                <el-input class="el-input-item" size="small" v-model="formData.browser" placeholder="请输入浏览器类型"/>
                            </el-form-item>
                                                                                                                                                                                                                <el-form-item label="操作系统" prop="os">
                                <el-input class="el-input-item" size="small" v-model="formData.os" placeholder="请输入操作系统"/>
                            </el-form-item>
                                                                                                                                                                                                                <el-form-item label="登录状态">
                                <el-radio-group v-model="formData.status" class="el-input-item" size="small">
                                    <el-radio
                                            v-for="dict in statusOptions"
                                            :key="dict.dictValue"
                                            :label="dict.dictValue"
                                    >{{dict.dictLabel}}
                                    </el-radio>
                                </el-radio-group>
                            </el-form-item>
                                                                                                                                                                                                                <el-form-item label="提示消息" prop="msg">
                                <el-input class="el-input-item" size="small" v-model="formData.msg" placeholder="请输入提示消息"/>
                            </el-form-item>
                                                                                                                                                                                                                <el-form-item label="访问时间" prop="loginTime">
                                <el-date-picker clearable size="small" style="width: 260px"
                                                v-model="formData.loginTime"
                                                type="date"
                                                value-format="yyyy-MM-dd"
                                                placeholder="选择访问时间">
                                </el-date-picker>
                            </el-form-item>
                                                                                </el-form>
        <div style="text-align: center;margin-top: 5%">
            <el-button size="small" @click="closePage">取 消</el-button>
            <el-button size="small" type="primary" @click="handleSubmit">确 定</el-button>
        </div>
    </template>
</div>
</body>
<script th:src="@{/static/js/axios.min.js}"></script>
<script th:src="@{/static/js/request.js}"></script>
<script th:src="@{/static/js/common.js}"></script>
<script th:src="@{/static/api/sysLoginRecord.js}"></script>
<script th:src="@{/static/js/vue.min.js}"></script>
<script th:src="@{/static/element/index.js}"></script>
<script th:src="@{/static/js/jquery.min.js}"></script>
<script th:src="@{/static/layer/layer.js}"></script>
<script>
    let id = getQueryString("id");
    new Vue({
        el: '#app',
        data() {
            return {
                formData: {
                    id: '',
                    postName: '',
                    postCode: '',
                    remark: ''
                },
                rules: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                }
            }
        },
        created() {
            if (id) {
                detail(id).then((res) => {
                    if (res.code === '200') {
                        this.formData = res.data
                    }
                });
            } else {
                this.formData = {}
            }

        },
        methods: {
            handleSubmit() {
                if (id) {
                    addOrUpdate('/admin/sysLoginRecord/update', this);
                } else {
                    addOrUpdate('/admin/sysLoginRecord/add', this);
                }
            }
        }
    });
</script>
</html>
